import sum from "./utils.js";
console.log(sum(10,20));
//worker1线程代码任务的执行操作
self.addEventListener("message",e=>{
    console.log("来自主线程发送的数据内容",e.data);

    postMessage("post to main thread work");

    setTimeout(()=>{
        console.log("time run")
        postMessage("time up doing")
    },500)

    Promise.resolve().then(res=>{
        console.log("promise run")
        postMessage("promise micro worker doing");
    })

    for(let i =0;i<1000;i++){
        if(i==500){
            console.log("for loop run")
            postMessage("for loop is doing")
        }
    }

    //

    // close();//子线程关闭
})

// console.log(sum(10,40))

export default self;